<template>
  <div class="system-customer main">
    <xr-header
      label="企业安全设置" />
    <div class="main-content-wrap">
      <!-- 客户管理导航 -->
      <div class="main-nav">
        <div class="main-nav__content">
          <div class="nav-sections-wrap">
            <div
              v-for="(item, index) in menuList"
              :key="index"
              :class="{'is-select' : item.key == menuIndex}"
              class="menu-item"
              @click="menuSelect(item.key)">
              {{ item.label }}
            </div>
          </div>
        </div>
      </div>
      <keep-alive>
        <component
          :is="componentName"
          :types="types"
          class="main-content" />
      </keep-alive>
    </div>
  </div>
</template>

<script>
import PasswordRuleSetting from './components/PasswordRuleSetting' // 密码规则设置
import LogoutRuleSetting from './components/LogoutRuleSetting' // 登出规则设置
import WatermarkSetting from './components/WatermarkSetting' // 水印设置
import XrHeader from '@/components/XrHeader'

export default {
  name: 'EnterpriseSecuritySetting',

  components: {
    PasswordRuleSetting,
    LogoutRuleSetting,
    WatermarkSetting,
    XrHeader
  },

  data() {
    return {
      menuList: [
        { label: '密码规则设置', key: 'password-rule-setting' },
        { label: '登出规则设置', key: 'logout-rule-setting' },
        { label: '水印设置', key: 'watermark-setting' }
      ],
      menuIndex: 'password-rule-setting',
      types: ''
    }
  },

  computed: {
    componentName() {
      return this.menuIndex
    }
  },

  methods: {
    /**
     * 菜单选择
     */
    menuSelect(i) {
      this.menuIndex = i
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
@import "../styles/index.scss";

.main-content-wrap {
  margin-top: #{$--interval-base * 2};
}

.nav-sections-wrap {
  padding: $--interval-base;
}
</style>
